/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package sca;

/**
 *
 * @author San
 */
import java.sql.Connection;

import java.sql.PreparedStatement;

import java.sql.SQLException;

public abstract class Geral {


    private Connection connection;
    protected Geral() {

    this.connection = ConnectionDatabase.getConnection();

    }

    protected Connection getConnection() {
        return connection;

    }



    protected void save(String insertSql, Object... parametros) throws SQLException {

        PreparedStatement pstmt = getConnection().prepareStatement(insertSql);



        for (int i = 0; i < parametros.length; i++) {

            pstmt.setObject(i+1, parametros[i]);

        }



    pstmt.execute();

    pstmt.close();

    }

}


